{include file="public/layout" /}
<body>
  <div class="layui-fluid" id="LAY-component-layer-list">
    <div class="layui-row">
      <div class="layui-col-md12">
        <div class="layui-card">
          <div class="web-system">
            <div class="layui-tab layui-tab-card">
              {include file="system/bar" /}
              <div class="layui-tab-content" style="padding:10px 0">
                <div class="layui-tab-item layui-show">
                    <div class="layui-row layui-col-space15">
                      <div class="layui-col-md12">
                        <div class="layui-card">
                          <div class="layui-card-body" pad15>
                            <div class="layui-form" wid100 lay-filter="">
                              <div class="layui-form-item">
                                <label class="layui-form-label">主页链接名</label>
                                <div class="layui-input-inline">
                                  <input type="text" name="basic_indexname" value="{$config.basic_indexname|default='首页'}" class="layui-input">
                                </div>
                              </div>
                              <div class="layui-form-item">
                                <label class="layui-form-label">栏目位置间隔符</label>
                                <div class="layui-input-inline">
                                  <input type="text" name="list_symbol" value="{$config.list_symbol|default=' > '}" class="layui-input">
                                </div>
                              </div>
                              <div class="layui-form-item">
                                <label class="layui-form-label">上传图片类型</label>
                                <div class="layui-input-inline">
                                   <textarea name="image_type" class="layui-textarea">{empty name='config.image_type'}jpg|gif|png|bmp|jpeg|ico{else /}{$config.image_type}{/empty}</textarea>
                                </div>
                                <div class="layui-form-mid layui-word-aux ey_helptips"></div>
                                <div class="layui-form-inline2 ey_helptips_txt">禁止非图片的扩展名，比如：php</div>
                              </div>
                              <div class="layui-form-item">
                                <label class="layui-form-label">上传软件类型</label>
                                <div class="layui-input-inline">
                                   <textarea name="file_type" class="layui-textarea">{empty name='config.file_type'}zip|gz|rar|iso|doc|xsl|ppt|wps{else /}{$config.file_type}{/empty}</textarea>
                                </div>
                                <div class="layui-form-mid layui-word-aux ey_helptips"></div>
                                <div class="layui-form-inline2 ey_helptips_txt">禁止非软件的扩展名，比如：php</div>
                              </div>
                              <div class="layui-form-item">
                                <label class="layui-form-label">多媒体文件类型</label>
                                <div class="layui-input-inline">
                                   <textarea name="media_type" class="layui-textarea">{empty name='config.media_type'}swf|mpg|mp3|rm|rmvb|wmv|wma|wav|mid|mov|mp4{else /}{$config.media_type}{/empty}</textarea>
                                </div>
                                <div class="layui-form-mid layui-word-aux ey_helptips"></div>
                                <div class="layui-form-inline2 ey_helptips_txt">禁止非媒体的扩展名，比如：php</div>
                              </div>
                              <div class="layui-form-item">
                                <label class="layui-form-label">附件上传大小</label>
                                <div class="layui-input-inline" style="width:150px">
                                   <input style="width: 100px;float: left" type="text" name="file_size" lay-verify="number|check_filesize" value="{$config.file_size|default=$max_filesize}" class="layui-input"> <span style="float: left;line-height: 38px;margin-left: 4px;"> {$max_sizeunit}</span>
                                </div>
                                <div class="layui-form-mid layui-word-aux ey_helptips"></div>
                                <div class="layui-form-inline2 ey_helptips_txt">附件上传大小限制，如果空间不支持，请与空间商联系修改php.ini部分参数</div>
                              </div>
                              <div class="layui-form-item">
                                <div class="layui-input-block">
                                    <input type="hidden" name="max_filesize" id="max_filesize" value="{$max_filesize}">
                                    <input type="hidden" name="max_sizeunit" id="max_sizeunit" value="{$max_sizeunit}">
                                    <button class="layui-btn" lay-submit lay-filter="formSubmit">确认提交</button>
                                </div>
                              </div>
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                </div>
              </div>
            </div>
          </div>
        </div>
     </div>
  </div>

<script type="text/javascript">
  layui.config({
    base: '__SKIN__/' //静态资源所在路径
    ,version: '{$version}'
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form'], function(){
    var $ = layui.$
    ,layer = layui.layer
    ,form = layui.form;

    form.verify({
      check_filesize: function(value, item){ //value：表单的值、item：表单的DOM对象
        var file_size = value;
        var max_filesize = parseInt($('#max_filesize').val());
        var max_sizeunit = $('#max_sizeunit').val();
        if (0 < max_filesize && max_filesize < file_size) {
            return '附件上传大小超过空间的最大限制'+max_filesize+max_sizeunit;
        }
      }
    }); 

    //监听提交
    form.on('submit(formSubmit)', function(data){
        var load = layer_loading();
        data.field._ajax = 1;
        $.ajax({
            type : 'post',
            url : "{:url('System/basic')}",
            data : data.field,
            dataType : 'json',
            success : function(res){
                layer.close(load); //关闭loading
                if(res.code == 1){
                    layer.msg(res.msg, {icon: 1, time: 1000}, function(){
                        window.location.reload();
                    });
                }else{
                    showErrorMsg(res.msg);
                }
            },
            error: function(e){
                layer.close(load); //关闭loading
                showErrorAlert();
            }
        });
        return false;
    });
    
  });
  </script>

{include file="public/footer" /}
